import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BusinessInfoVO, BusinessInfoForm, BusinessInfoQuery } from '@/api/business/businessInfo/types';

/**
 * 查询比算表信息列表
 * @param query
 * @returns {*}
 */

export const listBusinessInfo = (query?: BusinessInfoQuery): AxiosPromise<BusinessInfoVO[]> => {
  return request({
    url: '/business/businessInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询比算表信息详细
 * @param id
 */
export const getBusinessInfo = (id: string | number): AxiosPromise<BusinessInfoVO> => {
  return request({
    url: '/business/businessInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增比算表信息
 * @param data
 */
export const addBusinessInfo = (data: BusinessInfoForm) => {
  return request({
    url: '/business/businessInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改比算表信息
 * @param data
 */
export const updateBusinessInfo = (data: BusinessInfoForm) => {
  return request({
    url: '/business/businessInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除比算表信息
 * @param id
 */
export const delBusinessInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/businessInfo/' + id,
    method: 'delete'
  });
};
